{extend name="template/base" /}
{block name="content"}
<br><br><br>
<!--select2样式 start -->
<link href="__LIB__/select2-4.0.3/dist/css/select2.min.css" rel="stylesheet" />
<div class="page-container">
    {php} use think\Db;{/php}
    {include file="form" /}
    <style>
        table,table tr th, table tr td { border:1px solid #000; }
    </style>
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
            {tp:menu menu="add,delete" /}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="70">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                {tp:menu menu='sedit' /}
                <a href="javascript:;" onclick="dels({$vo.id})"><i class="Hui-iconfont">&#xe6e2;</i> </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}
{block name='script'}
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<!--select2 js 插件-->
<script type="text/javascript" src="__LIB__/select2-4.0.3/dist/js/select2.min.js"></script>
<script>

    var room_type_id = $("#room_type_id").select2({
        language: "zh-CN", //设置 提示语言
        width: "100%", //设置下拉框的宽度
        theme: "classic"
    })
    {notempty name = "Request.param.room_type_id"}
    room_type_id.val("{$Request.param.room_type_id}").trigger("change");
    {/notempty}
</script>
<script>
    function dels(id) {
        if (!id) {
            layer.msg('缺少参数');
            return false;
        }
        $.ajax({
            type: 'POST',
            url: '/admin/hotel_reservation/delete',
            data: {id: id},
            success: function (ret) {
                if(ret.code){
                    layer.msg(ret.msg);
                    return false;
                }else{
                    layer.msg(ret.msg);
                    location.reload();
                }
            }
        });
    }
</script>
{/block}